//
//  TrebuchetPieceFactory.m
//  INFSWA02
//
//  Created by Justin van Grootveld on 9/27/11.
//  Copyright 2011 Pro4all. All rights reserved.
//

#import "TrebuchetPieceFactory.h"
#import "Piece.h"
#import "Catapult.h"

#import "Player.h"

@implementation TrebuchetPieceFactory

#define name @"Trebuchet"
#define code @"T"

+ (Piece *)createPieceForPlayer:(Player *)player
{
    //basic piece
    Piece *piece = [[Piece alloc] initWithName:name 
                                        player:player 
               andBaseStatsPhysicalAttackPower:50 
                            magicalAttackPower:0 
                               physicalDefense:10 
                                magicalDefense:0 
                                  healthPoints:150 
                                         range:2 
                                      movement:2];

    if(player.identifier == 1) //player that starts at bottom-left
    {
        [piece setMoveDirection: TOP | LEFT | RIGHT | TOPLEFT | TOPRIGHT | BOTTOM];
        [piece setAttackDirection: TOP | LEFT | RIGHT];
    }
    else
    {
        [piece setMoveDirection: BOTTOM | LEFT | RIGHT | TOPLEFT | TOPRIGHT | BOTTOM];
        [piece setAttackDirection: BOTTOM | LEFT | RIGHT];
    }
    
    [piece setCanAttackTroughAir:YES];
    
    [piece setCode:code];
    
    //gear
    Gear *gear = [Catapult new];
    
    [piece setGear:gear];
    
    return piece;
}


@end
